package com.example.gitbootdemo.demos.web;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author <a href="mailto:290982492@qq.com">刘垛生</a>
 */
@RestController
@RequestMapping("/coupon")
public class CouponController {


    @RequestMapping("/getCoupon")
    @ResponseBody
    public String getCoupon(
            @RequestParam(name = "title", defaultValue = "618优惠券") String title,
            @RequestParam(name = "type", defaultValue = "满减券") String type,
            @RequestParam(name = "amount", defaultValue = "") Double amount,
            @RequestParam(name = "startDate", defaultValue = "") String startTime,
            @RequestParam(name = "endDate", defaultValue = "") String endTime) {
        return "优惠券名称:" + title + ",优惠券类型:" + type + ",优惠券金额:" + amount + ",优惠券有效期:" + startTime + "-" + endTime;
    }


    @RequestMapping("/getAllCoupon")
    @ResponseBody
    public String getAllCoupon() {
        return "获取所有的优惠券列表信息";
    }



    @RequestMapping("/useCoupon")
    @ResponseBody
    public String useCoupon() {
        return "使用优惠券成功";
    }


    @RequestMapping("/addCoupon")
    @ResponseBody
    public String createCoupon() {
        return "创建优惠券";
    }


    @RequestMapping("/update123Coupon")
    @ResponseBody
    public String updateCoupon() {
        return "修改优惠券成功1123223231311";
    }



    @RequestMapping("/updateCoupon7")
    @ResponseBody
    public String updateCoupon9() {
        return "修改优惠券成功11232311";
    }

    @RequestMapping("/updateCouponhhh")
    @ResponseBody
    public String updateCouponhhh() {
        return "修改优惠券成功adfasfd";
    }


}
